/**
 * 
 */
package com.suyx.job.utils.mh;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.suyx.job.utils.ScreenCapture;

import lombok.extern.slf4j.Slf4j;

/**
 * @author syx
 *
 */
@Slf4j
@Component
public class DtjwScene {
	@Autowired
	private WaTuUtils waTuUtils;
	
	public final static Map<String,String> options_x = new HashMap<>();  
	public final static Map<String,String> options_y = new HashMap<>();
	static {  
		options_x.put("0", "584 436");  
		options_x.put("1", "293 340");  
		options_x.put("2", "393 340");
		options_x.put("3", "493 340"); 
		options_x.put("4", "284 437");
		options_x.put("5", "390 437");
		options_x.put("6", "490 437");
		options_x.put("7", "288 535");
		options_x.put("8", "388 535");
		options_x.put("9", "488 535");
		
		options_y.put("0", "727 447");  
		options_y.put("1", "420 343");  
		options_y.put("2", "520 343");
		options_y.put("3", "620 343"); 
		options_y.put("4", "423 437");
		options_y.put("5", "523 437");
		options_y.put("6", "623 437");
		options_y.put("7", "421 535");
		options_y.put("8", "521 535");
		options_y.put("9", "621 535");
	} 
	
	public  void dtjw(String device ,String zuobiao,String baoguo) throws Exception{
		//打开包裹
		ScreenCapture.mouseClick(device, "1308 675");
		ScreenCapture.mouseClick(device, "1000 224");// 打开zzg 7
		ScreenCapture.mouseClick(device, "522 422");// 使用
		ScreenCapture.mouseClick(device, "370 603");//7
		ScreenCapture.mouseClick(device, "1156 52");// 关闭包裹
		ScreenCapture.mouseClick(device, "74 668");// 出朱紫国到境外
	}
	
	public  void dtjwSceneSame(String device,String zuobiao,String baoguo) throws Exception{
		Thread.sleep(2 * 1000L);
		ScreenCapture.mouseClick(device, "117 68");//打开地图
        ScreenCapture.mouseClick(device, "301 225");// 选x坐标
        String x = zuobiao.split(" ")[0];
        String y = zuobiao.split(" ")[1];
        input_x(device,x);
        ScreenCapture.mouseClick(device, "588 535");
        ScreenCapture.mouseClick(device, "460 225"); // 选y坐标
        input_y(device, y);
        ScreenCapture.mouseClick(device, "721 535");
        ScreenCapture.mouseClick(device, "590 228");  // 前往
        ScreenCapture.mouseClick(device, "1256 200"); //关闭地图
        //开始挖图
        waTuUtils.startWatu(device, zuobiao, baoguo);
	}
	
	private  void input_x(String device,String x){
		for(int i =0;i<x.length();i++){
			char c = x.charAt(i);
			String x_zb = options_x.get(String.valueOf(c));
			ScreenCapture.mouseClick(device, x_zb);
		}
	}
	
	private void input_y(String device,String y){
		for(int i =0;i<y.length();i++){
			char c = y.charAt(i);
			String y_zb = options_y.get(String.valueOf(c));
			ScreenCapture.mouseClick(device, y_zb);
		}
	}
	

}
